package springboot.service.impl;


import org.springframework.stereotype.Service;
import springboot.dao.StaffDao;
import springboot.doMain.Staff;
import springboot.service.StaffService;

import java.util.List;


@Service
public class StaffServiceImpl
        implements StaffService {

    final StaffDao staffDao;

    public StaffServiceImpl(StaffDao staffDao) {
        this.staffDao = staffDao;
    }

    @Override
    public List<Staff> sel_all_engineer() {
        List<Staff> staffList;
        staffList = staffDao.sel_all_engineer();
        return staffList;
    }

    @Override
    public Staff selectByName(String username) {
        if (username == null) {
            return null;
        }
        try {
            return staffDao.selectByName(username);
        } catch (Exception e) {
            System.err.println("selectByName = " + e);
            return null;
        }

    }
}
